<?php

class Bug_model extends Model
{
	function Bug_model()
	{
		parent::Model();
	}
	
	public function save($user_id, $bugtype, $bugtext)
	{
		$this->load->library('user_agent');		
		
		$user_id = (int)$user_id;
		$bugtype = (int)$bugtype;
		$bugtext = $this->db->escape($bugtext);
		$user_agent = $this->db->escape( $this->agent->agent_string() );
		
		$sql = "INSERT INTO bug_reports
				SET user_id = $user_id,
					dt = NOW(),
					description = $bugtext,
					type = $bugtype,
					user_agent = $user_agent";
		$this->db->query($sql);
	}
}